﻿<!-- #Include File="../Include/Admin_Onlogin.asp" -->
<!-- #Include File="../../Include/WriteHtml.asp" -->
<!-- #Include File="Channel_Config.asp" -->
<%
Dim sqlAuth, rsAuth, PurviewID
sqlAuth = "Select AuthID From Admin_Auth Where href='" & ChannelDir & "/Admin_Create" & ChannelDir & ".asp?ChannelID="&ChannelID&"' Order By sort Asc,AuthID Asc"
Call Exec(rsAuth,sqlAuth,2)
If rsAuth.BOF And rsAuth.EOF Then
	PurviewID = 0
Else
	PurviewID = rsAuth(0)
	CheckPurview PurviewID,0
End If
rsAuth.Close
Set rsAuth = Nothing

If Not ChannelIsCreateHtml = True Then
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>" & ChannelTit & "生成管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<script type='text/javascript'>Dialog.alert('对不起~！此模型不支持生成HTML功能。如果你要使用生成HTML功能，请在此模型管理中打开HTML生成功能！',function(){parent.tab.getdeleteTab();});</script>"
	Response.Write "</body>" & vbCrLf & "</html>"
	Response.End()
End If

Server.ScriptTimeout = 99999
ChannelID = Code_ID("ChannelID")
If ChannelID = 0 Then ChannelID = 1
Call GetChannel(ChannelID)
Dim p,l,v
dim Ls,ChannelIndexUrl,ChannelIndexPath,IndexPath,ShowmPath,ListUrl,ListPath,ViewUrl,ViewPath
Set Ls=New Cls_HTML

Select Case Action
	Case "Index"
		sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Create/Index' Order By sort Asc,AuthID Asc"
		Call Exec(rsAuth,sqlAuth,2)
		If rsAuth.BOF And rsAuth.EOF Then
			CheckPurview 0,0
		Else
			CheckPurview rsAuth(0),0
		End If
		rsAuth.Close
		Set rsAuth = Nothing
		Response.Write "<!DOCTYPE html>" & vbCrLf
		Response.Write "<head>" & vbCrLf
		Response.Write "<title>" & ChannelTit & "生成管理</title>" & vbCrlf
		Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
		Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
		Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
		Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
		Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<script type='text/javascript'>" & vbCrLf
		Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
		Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
		Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
		Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
		Response.Write "</head>" & vbCrlf
		Response.Write "<body>" & vbCrlf
		Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
		Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
		Response.Write "        <legend>" & ChannelTit & "HTML生成管理</legend>" & vbCrlf
		Response.Write "    </fieldset>" & vbCrlf
		Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrlf
		Response.Write "        <a href=""" & LinkedStr("") & """ class=""layui-btn layui-btn-sm"">管理首页</a>" & vbCrlf
		Response.Write "        <a href=""" & LinkedStr("Index") & """ class=""layui-btn layui-btn-sm"">生成首页HTML</a>" & vbCrlf
		Response.Write "    </blockquote>" & vbCrlf
		If Web_IsCreatIndex=True And Web_IsCreatIndexShow=True Then
			p=4
		ElseIf Web_IsCreatIndex=True Or Web_IsCreatIndexShow=True Then
			p=3
		Else
			p=2
		End If
		Response.Write("<div id=""prompt""><ul>")
		progress_init
		progress int(1/p*100),"读取模型首页数据,开始模型首页..."
		ChannelIndexUrl = InstallDir & ChannelDir & "/Index.asp"
		ChannelIndexPath = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
		HtmlContent = ShowChannelIndex(True)
		WriteTOFile ChannelIndexPath,HtmlContent
		HtmlContent = ""
		progress int(2/p*100),"生成模型首页（HTML）完成,开始生成模型首页..."
		If Web_IsCreatIndex=True Then
			IndexPath = InstallDir & Web_IndexFile
			HtmlContent = Html.SiteIndex(True)
			WriteTOFile IndexPath,HtmlContent
			HtmlContent = ""
			If Web_IsCreatIndexShow=True Then
				progress int(3/p*100),"生成网站导页（HTML）完成."
			Else
				progress int(p/p*100),"生成网站导页（HTML）完成."
			End If
		End If
		If Web_IsCreatIndexShow=True Then
			ShowmPath = InstallDir & Web_IndexShowFile
			HtmlContent = Html.SiteShow(True)
			WriteTOFile ShowmPath,HtmlContent
			HtmlContent = ""
			progress int(p/p*100),"生成网站首页（HTML）完成."
		End If
		If IsConn = False Then Call CloseConn()
		Response.Write "<b>恭喜您！模型首页、网站导页、网站首页（HTML）生成完毕,请返回进行其它操作!</b><br>"
		Response.Write EndTime()
		Response.Write("</ul></div>")
		Response.Write "</div>" & vbCrlf
		Response.Write "</body>" & vbCrLf & "</html>"
	Case "List"
		sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Create/List' Order By sort Asc,AuthID Asc"
		Call Exec(rsAuth,sqlAuth,2)
		If rsAuth.BOF And rsAuth.EOF Then
			CheckPurview 0,0
		Else
			CheckPurview rsAuth(0),0
		End If
		rsAuth.Close
		Set rsAuth = Nothing
		Call Create_Article_List
	Case "Cont"
		sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Create/View' Order By sort Asc,AuthID Asc"
		Call Exec(rsAuth,sqlAuth,2)
		If rsAuth.BOF And rsAuth.EOF Then
			CheckPurview 0,0
		Else
			CheckPurview rsAuth(0),0
		End If
		rsAuth.Close
		Set rsAuth = Nothing
		Call Create_Article_Content
	Case "IndexList"
		Call Create_Article_IndexList
	Case "ListCont"
		Call Create_Article_ListContent
	Case Else
		Call ShowMain
End Select
If FoundErr = True Then
	Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Call CloseConn()

Function EndTime()
	EndTime = "总费时<font color=""#FF0000"">" & FormatNumber((timer()-BeginTime), 2,-1) & "</font>秒,完成时间" & Now()
End Function

Sub ShowMain()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>" & ChannelTit & "生成管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>" & ChannelTit & "HTML生成管理</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrlf
	Response.Write "        <a href=""" & LinkedStr("") & """ class=""layui-btn layui-btn-sm"">管理首页</a>" & vbCrlf
	Response.Write "        <a href=""" & LinkedStr("Index") & """ class=""layui-btn layui-btn-sm"">生成首页HTML</a>" & vbCrlf
	Response.Write "    </blockquote>" & vbCrlf
	Response.Write "<form class='layui-form layui-form-pane' id='Createform' name='Createform' method='post' action='?ChannelID=" & ChannelID & "'>" & vbCrLf
	Response.Write "    <input type='hidden' id='Action' name='Action' value=''>" & vbCrLf
	Response.Write "    <input type='hidden' id='ChannelID' name='ChannelID' value='" & ChannelID & "'>" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>批量生成" & ChannelTit & "HTML页管理</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目选择：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <div id=""ClassID"" class=""xm-select-demo""></div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-input-b"">" & vbCrlf
	Response.Write "            <button type=""submit"" class=""layui-btn"" accesskey=""s"" lay-submit="""" lay-filter=""submit"">生成栏目列表的HTML[S]</button>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-b"">" & vbCrlf
	Response.Write "            <button type=""submit"" class=""layui-btn"" accesskey=""l"" lay-submit="""" lay-filter=""content"">生成" & ChannelTit & "内容的HTML[L]</button>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "</form>" & vbCrLf
	Response.Write "<script>" & vbCrLf
	Response.Write "layui.use(['form','element'], function () {" & vbCrLf
	Response.Write "    var form = layui.form,element = layui.element;" & vbCrLf
	Response.Write "    //自定义表单验证" & vbCrLf
	Response.Write "    form.verify({" & vbCrLf
	Response.Write "        ClassID: function (value, item) {" & vbCrLf
	Response.Write "            if (!value){" & vbCrLf
	Response.Write "                item.focus();" & vbCrLf
	Response.Write "                return ""栏目选择不能为空！"";" & vbCrLf
	Response.Write "            }" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "    });" & vbCrLf
	Response.Write "    var ClassID = xmSelect.render({" & vbCrLf
	Response.Write "        el: '#ClassID'," & vbCrLf
	Response.Write "        name: 'ClassID'," & vbCrLf
	Response.Write "        layVerify: 'ClassID'," & vbCrLf
	'Response.Write "        radio: true," & vbCrLf
	'Response.Write "        clickClose: true," & vbCrLf
	'Response.Write "        tips: '指定栏目的" & ChannelTit & "?'," & vbCrLf
	'Response.Write "        empty: '呀, 没有数据呢'," & vbCrLf
	Response.Write "        autoRow: true," & vbCrLf
	Response.Write "        filterable: true," & vbCrLf
	Response.Write "        height: '300px'," & vbCrLf
	Response.Write "        direction: 'down'," & vbCrLf
	Response.Write "        tree: {" & vbCrLf
	Response.Write "            show: true,//是否显示树状结构" & vbCrLf
	Response.Write "            showFolderIcon: true,//是否展示三角图标" & vbCrLf
	Response.Write "            showLine: true,//是否显示虚线" & vbCrLf
	Response.Write "            indent: 20,//间距" & vbCrLf
	Response.Write "            expandedKeys: true,//默认展开节点的数组, 为 true 时, 展开所有节点" & vbCrLf
	Response.Write "            strict: false,//是否严格遵守父子模式" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        toolbar: {" & vbCrLf
	Response.Write "            show: true," & vbCrLf
	Response.Write "            list: ['ALL', 'REVERSE', 'CLEAR']" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        data: [" & vbCrLf
	Response.Write GetClass_Option(ChannelID, 0, ClassID)
	Response.Write "        ]" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "    //提交监听" & vbCrLf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrLf
	Response.Write "        document.Createform.Action.value='List';" & vbCrLf
	Response.Write "    });" & vbCrLf
	Response.Write "    //提交监听" & vbCrLf
	Response.Write "    form.on('submit(content)', function (data) {" & vbCrLf
	Response.Write "        document.Createform.Action.value='Cont';" & vbCrLf
	Response.Write "    });" & vbCrLf
	Response.Write "});" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "</div>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Function LinkedStr(Str)
	LinkedStr = "?Action=" & Str & "&ChannelID="& ChannelID
End Function

Sub Create_Article_List()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>" & ChannelTit & "生成管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>" & ChannelTit & "HTML生成管理</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrlf
	Response.Write "        <a href=""" & LinkedStr("") & """ class=""layui-btn layui-btn-sm"">管理首页</a>" & vbCrlf
	Response.Write "        <a href=""" & LinkedStr("Index") & """ class=""layui-btn layui-btn-sm"">生成首页HTML</a>" & vbCrlf
	Response.Write "    </blockquote>" & vbCrlf
	Select Case Web_IsCreatIndexShow
	Case True
		IndexFile = InstallDir & Web_IndexShowFile
	Case Else
		IndexFile = InstallDir & IndexShow
	End Select
	Select Case ChannelIsCreateHtml
	Case True
		ChannelIndexFile = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	Case Else
		ChannelIndexFile = InstallDir & ChannelDir & "/Index.asp"
	End Select
	If Trim(Request.Form("ClassID")) = "" Then
		ErrMsg = "<li>请选择栏目~！</li>"
		FoundErr = True 
		Exit Sub
	End If
	cSQL = " And ClassID in (" & Trim(Request.Form("ClassID")) & ")"
	totalnumber = Exec("","Select Count(ClassID) From [Class] Where ChannelID=" & ChannelID & cSQL,1)(0)
	Call Exec(rsClass,"Select * From Class Where ChannelID=" & ChannelID & cSQL & " Order By ClassOrder Asc,ClassID Asc",2)
	If rsClass.eof And rsClass.bof Then
		Response.Write "<meta http-equiv=""refresh"" content=""1;url='?ChannelID=" & ChannelID & "'"">"
		Set rsClass = Nothing
		Exit Sub
	End If
	k=0
	p=totalnumber+1
	Response.Write("<div id=""prompt""><ul>")
	progress_init
	progress int(0*100),"正在读取数据,开始生成HTML..."
	while not rsClass.eof
		If Is_Null(rsClass("PageNum")) = "" Or rsClass("PageNum") = 0 Then
			intPageSize = CLng(ChannelListNum(1))
		Else
			intPageSize = CLng(rsClass("PageNum"))
		End If
		If intPageSize <= 0 Then intPageSize = 20
		intRecordCount = Exec("","Select Count(*) From [" & ChannelDataName & "] Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ClassID in (" & rsClass("ClassChildStr") & ")",1)(0)
		if ( intRecordCount mod intPageSize <> 0) Then
			intRecordCount=Fix(intRecordCount/intPageSize)+1
		else
			intRecordCount=Fix(intRecordCount/intPageSize)
		end if
		if intRecordCount=0 then intRecordCount=1
		Ls.MD InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir")
		For i = 1 To intRecordCount
			if i=1 Then
				ListUrl=InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClass("ClassID")
				ListPath=InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir") & "Index" & ChannelHtmlExtName
				ShowChannelList rsClass("ClassID"),True,ListPath,1
			else
				ListUrl=InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClass("ClassID") & "&Page=" & i
				ListPath=InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir") & "Index_" & i & ChannelHtmlExtName
				ShowChannelList rsClass("ClassID"),True,ListPath,i
			end if
			progress int((k+1)/p*100),"共有栏目 <B><font color='red'>" & totalnumber & "</font></B> 个　正在生成第 " & k & " 个,(第 " & i & " 页) "
		Next
	rsClass.movenext
	k=k+1
	wend
	rsClass.Close:Set rsClass = Nothing
	If IsConn = False Then Call CloseConn()
	progress int(p/p*100),"共有栏目 <B><font color='red'>" & totalnumber & "</font></B> 个　全部生成完毕! "
	Response.Write "<b>恭喜您！HTML栏目页面生成完毕,请返回进行其它操作!</b><br>"
	Response.Write EndTime()
	Response.Write("</ul></div>")
	Response.Write "</div>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Create_Article_Content()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>" & ChannelTit & "生成管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>" & ChannelTit & "HTML生成管理</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrlf
	Response.Write "        <a href=""" & LinkedStr("") & """ class=""layui-btn layui-btn-sm"">管理首页</a>" & vbCrlf
	Response.Write "        <a href=""" & LinkedStr("Index") & """ class=""layui-btn layui-btn-sm"">生成首页HTML</a>" & vbCrlf
	Response.Write "    </blockquote>" & vbCrlf
	Select Case Web_IsCreatIndexShow
	Case True
		IndexFile = InstallDir & Web_IndexShowFile
	Case Else
		IndexFile = InstallDir & IndexShow
	End Select
	Select Case ChannelIsCreateHtml
	Case True
		ChannelIndexFile = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	Case Else
		ChannelIndexFile = InstallDir & ChannelDir & "/Index.asp"
	End Select
	Dim j,u,lContent,ContentLen,MaxPerPage,lngBound,strTemp,HasPageTitle
	Dim BeginPoint,EndPoint,CurrentPage,totalnumber
	If Trim(Request.Form("ClassID")) = "" Then
		ErrMsg = "<li>请选择栏目~！</li>"
		FoundErr = True 
		Exit Sub
	End If
	cSQL = "Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ClassID in (" & Request.Form("ClassID") & ")"
	totalnumber = Exec("","Select Count(ID) From [" & ChannelDataName & "] "& cSQL &"",1)(0)
	i=0
	p=totalnumber+1
	Response.Write("<div id=""prompt""><ul>")
	progress_init
	progress int(0*100),"正在读取数据,开始生成HTML..."
	Call Exec(cRs,"Select * From " & ChannelDataName & " "& cSQL &" order by ID asc",2)
	while not cRs.eof
		Ls.MD InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath)
		PaginationType=cRs("PaginationType")
		MaxCharPerPage=cRs("MaxCharPerPage")
		Select Case PaginationType
			Case 0    '不分页显示
				ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
				ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
				ShowChannelView cRs("ID"),True,ViewPath,1
				progress int((i+1)/p*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇 "
			Case 1    '自动分页显示
				ContentLen = Len(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1)))
				If MaxCharPerPage <= 100 Or ContentLen <= MaxCharPerPage Or InStr(LCase(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))), "<table") > 0 Or InStr(LCase(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))), "</table>") > 0 Then
					totalPage = 1
				Else
					totalPage = ContentLen \ MaxCharPerPage
					If MaxCharPerPage * totalPage < ContentLen Then
						totalPage = totalPage + 1
					End If
				End If
				For j = 1 To totalPage
					if j=1 Then
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
						ShowChannelView cRs("ID"),True,ViewPath,1
					else
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID") & "&Page=" & j
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, j)
						ShowChannelView cRs("ID"),True,ViewPath,j
					end if
					progress int((i+1)/p*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇,(第 " & j & " 页) "
				Next
			Case 2    '手动分页显示
				u = 1
				strTempContent = Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))
				strTemp = ""
				HasPageTitle = False
				regEx.MultiLine = False
				regEx.Pattern = "\[NextPage(.*?)\]"
				Set Matches = regEx.Execute(strTempContent)
				For Each Match In Matches
					If u = 1 Then
						If Match.SubMatches(0) <> "" Then
							If nohtml(Left(strTempContent, InStr(strTempContent, Match.SubMatches(0)))) <> "" Then
								strTempContent = Code_Replace(strTempContent, Match.Value, "") '去掉第一个匹配的[NextPage 分页标题]
								strTemp = "第 1 页：" & Trim(Match.SubMatches(0))
							Else
								strTemp = "第 1 页：$$$第 2 页：" & Trim(Match.SubMatches(0))
							u = u + 1
							End If
							HasPageTitle = True
						Else
							strTemp = "第 1 页：$$$第 2 页："
							u = u + 1
						End If
					Else
						If Match.SubMatches(0) <> "" Then
							strTemp = strTemp & "$$$第 " & u & " 页：" & Trim(Match.SubMatches(0))
							HasPageTitle = True
						Else
							strTemp = strTemp & "$$$第 " & u & " 页："
						End If
					End If
					u = u + 1
				Next
				regEx.MultiLine = True
				strTempContent = regEx.Replace(strTempContent, "[NextPage]")  '将[NextPage 分页标题]替换成[NextPage]
				If HasPageTitle = True Then
					strContentPageTitleArr = strTemp
				Else
					strContentPageTitleArr = ""
				End If
				Dim arrContent
				If InStr(strTempContent, "[NextPage]") <= 0 Then
					Exit Sub
				End If
				arrContent = Split(strTempContent, "[NextPage]")
				totalPage = UBound(arrContent) + 1
				If CurrentPage < 1 Then CurrentPage = 1
				If CurrentPage > totalPage Then CurrentPage = totalPage
				For u = 1 To totalPage
					if u=1 Then
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
						ShowChannelView cRs("ID"),True,ViewPath,1
					else
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID") & "&Page=" & u
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, u)
						ShowChannelView cRs("ID"),True,ViewPath,u
					end if
					progress int((i+1)/p*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇,(第 " & u & " 页) "
				Next
		End Select
		Call Exec("","Update " & ChannelDataName & " Set IsUpdate=" & WK_True & " Where ID="& CLng(cRs("ID")),0)
	cRs.movenext
	i=i+1
	wend
	cRs.Close:Set cRs = Nothing
	If IsConn = False Then Call CloseConn()
	progress int(p/p*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　全部生成完毕! "
	Response.Write "<b>恭喜您！HTML浏览页面生成完毕,请返回进行其它操作!</b><br>"
	Response.Write EndTime()
	Response.Write("</ul></div>")
	Response.Write "</div>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Create_Article_IndexList()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>" & ChannelTit & "生成管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
	Select Case Web_IsCreatIndexShow
	Case True
		IndexFile = InstallDir & Web_IndexShowFile
	Case Else
		IndexFile = InstallDir & IndexShow
	End Select
	Select Case ChannelIsCreateHtml
	Case True
		ChannelIndexFile = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	Case Else
		ChannelIndexFile = InstallDir & ChannelDir & "/Index.asp"
	End Select
	If Web_IsCreatIndex=True And Web_IsCreatIndexShow=True Then
		p=4
	ElseIf Web_IsCreatIndex=True Or Web_IsCreatIndexShow=True Then
		p=3
	Else
		p=2
	End If
	Response.Write("<div id=""prompt""><ul>")
	progress_init
	progress int(1/p*100),"读取模型首页数据,开始模型首页..."
	ChannelIndexUrl = InstallDir & ChannelDir & "/Index.asp"
	ChannelIndexPath = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	HtmlContent = ShowChannelIndex(True)
	WriteTOFile ChannelIndexPath,HtmlContent
	HtmlContent = ""
	HtmlContent = ""
	progress int(2/p*100),"生成模型首页（HTML）完成,开始生成模型首页..."
	If Web_IsCreatIndex=True Then
		IndexPath = InstallDir & Web_IndexFile
		HtmlContent = Html.SiteIndex(True)
		WriteTOFile IndexPath,HtmlContent
		HtmlContent = ""
		If Web_IsCreatIndexShow=True Then
			progress int(3/p*100),"生成网站导页（HTML）完成."
		Else
			progress int(p/p*100),"生成网站导页（HTML）完成."
		End If
	End If
	If Web_IsCreatIndexShow=True Then
		ShowmPath = InstallDir & Web_IndexShowFile
		HtmlContent = Html.SiteShow(True)
		WriteTOFile ShowmPath,HtmlContent
		HtmlContent = ""
		progress int(p/p*100),"生成网站首页（HTML）完成."
	End If
	Response.Write "<b>恭喜您！模型首页、网站导页、网站首页（HTML）生成完毕!</b><br>"
	If Trim(Request("ClassID")) = "" Then
		ErrMsg = "<li>请选择栏目~！</li>"
		FoundErr = True 
		Exit Sub
	End If
	cSQL = " And ClassID in (" & Trim(Request("ClassID")) & ")"
	totalnumber = Exec("","Select Count(ClassID) From [Class] Where ChannelID=" & ChannelID & cSQL,1)(0)
	Call Exec(rsClass,"Select * From Class Where ChannelID=" & ChannelID & cSQL & " Order By ClassOrder Asc,ClassID Asc",2)
	if rsClass.eof and rsClass.bof Then
	end if
	k=0
	l=totalnumber+1
	while not rsClass.eof
		If Is_Null(rsClass("PageNum")) = "" Or rsClass("PageNum") = 0 Then
			intPageSize = CLng(ChannelListNum(1))
		Else
			intPageSize = CLng(rsClass("PageNum"))
		End If
		If intPageSize <= 0 Then intPageSize = 20
		intRecordCount = Exec("","Select Count(*) From [" & ChannelDataName & "] Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ClassID in (" & rsClass("ClassChildStr") & ")",1)(0)
		if intRecordCount mod intPageSize <> 0 then
			intRecordCount=Fix(intRecordCount/intPageSize)+1
		else
			intRecordCount=Fix(intRecordCount/intPageSize)
		end if
		if intRecordCount=0 then intRecordCount=1
		Ls.MD InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir")
		For i = 1 To intRecordCount
			if i=1 Then
				ListUrl=InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClass("ClassID")
				ListPath=InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir") & "Index" & ChannelHtmlExtName
				ShowChannelList rsClass("ClassID"),True,ListPath,1
			else
				ListUrl=InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClass("ClassID") & "&Page=" & i
				ListPath=InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir") & "Index_" & i & ChannelHtmlExtName
				ShowChannelList rsClass("ClassID"),True,ListPath,i
			end if
			progress int((k+1)/l*100),"共有栏目 <B><font color='red'>" & totalnumber & "</font></B> 个　正在生成第 " & k & " 个,(第 " & i & " 页) "
		Next
	rsClass.movenext
	k=k+1
	wend
	rsClass.Close:Set rsClass = Nothing
	progress int(l/l*100),"共有栏目 <B><font color='red'>" & totalnumber & "</font></B> 个　全部生成完毕! "
	Response.Write "<b>恭喜您！HTML栏目页面生成完毕!</b><br>"
	id = Trim(Request("id"))
	If id = "" Then
		ErrMsg = "<li>请选择" & ChannelTit & "ID~！</li>"
		FoundErr = True 
		Exit Sub
	End If
	If Instr(id,",") >0 Then
		id=Split(id,",")
		If CLng(id(0)) < CLng(id(Ubound(id))) Then
			Tmpl=id(0)-1 & "," & id(Ubound(id))+1
		Else
			Tmpl=id(0)+1 & "," & id(Ubound(id))-1
		End If
	Else
		Tmpl=id-1 & "," & id & "," & id+1
	End If
	If Tmpl<>"" Then
		cSQL = "Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ID in (" & Tmpl & "," & Request("id") & ")"
	Else
		cSQL = "Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ID in (" & Request("id") & ")"
	End If
	totalnumber = Exec("","Select Count(ID) From [" & ChannelDataName & "] "& cSQL &"",1)(0)
	i=0
	v=totalnumber+1
	Call Exec(cRs,"Select * From " & ChannelDataName & " "& cSQL &" order by ID asc",2)
	while not cRs.eof
		Ls.MD InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath)
		PaginationType=cRs("PaginationType")
		MaxCharPerPage=cRs("MaxCharPerPage")
		Select Case PaginationType
			Case 0    '不分页显示
				ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
				ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
				ShowChannelView cRs("ID"),True,ViewPath,1
				progress int((i+1)/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇 "
			Case 1    '自动分页显示
				ContentLen = Len(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1)))
				If MaxCharPerPage <= 100 Or ContentLen <= MaxCharPerPage Or InStr(LCase(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))), "<table") > 0 Or InStr(LCase(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))), "</table>") > 0 Then
					totalPage = 1
				Else
					totalPage = ContentLen \ MaxCharPerPage
					If MaxCharPerPage * totalPage < ContentLen Then
						totalPage = totalPage + 1
					End If
				End If
				For j = 1 To totalPage
					if j=1 Then
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
						ShowChannelView cRs("ID"),True,ViewPath,1
					else
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID") & "&Page=" & j
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, j)
						ShowChannelView cRs("ID"),True,ViewPath,j
					end if
					progress int((i+1)/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇,(第 " & j & " 页) "
				Next
			Case 2    '手动分页显示
				u = 1
				strTempContent = Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))
				strTemp = ""
				HasPageTitle = False
				regEx.MultiLine = False
				regEx.Pattern = "\[NextPage(.*?)\]"
				Set Matches = regEx.Execute(strTempContent)
				For Each Match In Matches
					If u = 1 Then
						If Match.SubMatches(0) <> "" Then
							If nohtml(Left(strTempContent, InStr(strTempContent, Match.SubMatches(0)))) <> "" Then
								strTempContent = Code_Replace(strTempContent, Match.Value, "") '去掉第一个匹配的[NextPage 分页标题]
								strTemp = "第 1 页：" & Trim(Match.SubMatches(0))
							Else
								strTemp = "第 1 页：$$$第 2 页：" & Trim(Match.SubMatches(0))
							u = u + 1
							End If
							HasPageTitle = True
						Else
							strTemp = "第 1 页：$$$第 2 页："
							u = u + 1
						End If
					Else
						If Match.SubMatches(0) <> "" Then
							strTemp = strTemp & "$$$第 " & u & " 页：" & Trim(Match.SubMatches(0))
							HasPageTitle = True
						Else
							strTemp = strTemp & "$$$第 " & u & " 页："
						End If
					End If
					u = u + 1
				Next
				regEx.MultiLine = True
				strTempContent = regEx.Replace(strTempContent, "[NextPage]")  '将[NextPage 分页标题]替换成[NextPage]
				If HasPageTitle = True Then
					strContentPageTitleArr = strTemp
				Else
					strContentPageTitleArr = ""
				End If
				Dim arrContent
				If InStr(strTempContent, "[NextPage]") <= 0 Then
					Exit Sub
				End If
				arrContent = Split(strTempContent, "[NextPage]")
				totalPage = UBound(arrContent) + 1
				If CurrentPage < 1 Then CurrentPage = 1
				If CurrentPage > totalPage Then CurrentPage = totalPage
				For u = 1 To totalPage
					if u=1 Then
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
						ShowChannelView cRs("ID"),True,ViewPath,1
					else
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID") & "&Page=" & u
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, u)
						ShowChannelView cRs("ID"),True,ViewPath,u
					end if
					progress int((i+1)/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇,(第 " & u & " 页) "
				Next
		End Select
		Call Exec("","Update " & ChannelDataName & " Set IsUpdate=" & WK_True & " Where ID="& CLng(cRs("ID")),0)
	cRs.movenext
	i=i+1
	wend
	cRs.Close:Set cRs = Nothing
	If IsConn = False Then Call CloseConn()
	progress int(v/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　全部生成完毕! "
	Response.Write "<b>恭喜您！HTML浏览页面生成完毕,请返回进行其它操作!</b><br>"
	Response.Write EndTime()
	Response.Write("</ul></div>")
	Response.Write "</div>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Create_Article_ListContent()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>" & ChannelTit & "生成管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
	Select Case Web_IsCreatIndexShow
	Case True
		IndexFile = InstallDir & Web_IndexShowFile
	Case Else
		IndexFile = InstallDir & IndexShow
	End Select
	Select Case ChannelIsCreateHtml
	Case True
		ChannelIndexFile = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	Case Else
		ChannelIndexFile = InstallDir & ChannelDir & "/Index.asp"
	End Select
	If Web_IsCreatIndex=True And Web_IsCreatIndexShow=True Then
		p=4
	ElseIf Web_IsCreatIndex=True Or Web_IsCreatIndexShow=True Then
		p=3
	Else
		p=2
	End If
	Response.Write("<div id=""prompt""><ul>")
	progress_init
	progress int(1/p*100),"读取模型首页数据,开始模型首页..."
	ChannelIndexUrl = InstallDir & ChannelDir & "/Index.asp"
	ChannelIndexPath = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	HtmlContent = ShowChannelIndex(True)
	WriteTOFile ChannelIndexPath,HtmlContent
	HtmlContent = ""
	HtmlContent = ""
	progress int(2/p*100),"生成模型首页（HTML）完成,开始生成模型首页..."
	If Web_IsCreatIndex=True Then
		IndexPath = InstallDir & Web_IndexFile
		HtmlContent = Html.SiteIndex(True)
		WriteTOFile IndexPath,HtmlContent
		HtmlContent = ""
		If Web_IsCreatIndexShow=True Then
			progress int(3/p*100),"生成网站导页（HTML）完成."
		Else
			progress int(p/p*100),"生成网站导页（HTML）完成."
		End If
	End If
	If Web_IsCreatIndexShow=True Then
		ShowmPath = InstallDir & Web_IndexShowFile
		HtmlContent = Html.SiteShow(True)
		WriteTOFile ShowmPath,HtmlContent
		HtmlContent = ""
		progress int(p/p*100),"生成网站首页（HTML）完成."
	End If
	Response.Write "<b>恭喜您！模型首页、网站导页、网站首页（HTML）生成完毕!</b><br>"
	If Trim(Request("Csid")) = "" Then
		ClassID = Trim(Request("ClassID"))
	Else
		ClassID = Trim(Request("Csid"))
	End If
	If ClassID = "" Then
		ErrMsg = "<li>请选择栏目~！</li>"
		FoundErr = True 
		Exit Sub
	End If
	cSQL = " And ClassID in (" & ClassID & ")"
	totalnumber = Exec("","Select Count(ClassID) From [Class] Where ChannelID=" & ChannelID & cSQL,1)(0)
	Call Exec(rsClass,"Select * From Class Where ChannelID=" & ChannelID & cSQL & " Order By ClassOrder Asc,ClassID Asc",2)
	if rsClass.eof and rsClass.bof Then
	end if
	k=0
	l=totalnumber+1
	while not rsClass.eof
		If Is_Null(rsClass("PageNum")) = "" Or rsClass("PageNum") = 0 Then
			intPageSize = CLng(ChannelListNum(1))
		Else
			intPageSize = CLng(rsClass("PageNum"))
		End If
		If intPageSize <= 0 Then intPageSize = 20
		intRecordCount = Exec("","Select Count(*) From [" & ChannelDataName & "] Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ClassID in (" & rsClass("ClassChildStr") & ")",1)(0)
		if intRecordCount mod intPageSize <> 0 then
			intRecordCount=Fix(intRecordCount/intPageSize)+1
		else
			intRecordCount=Fix(intRecordCount/intPageSize)
		end if
		if intRecordCount=0 then intRecordCount=1
		Ls.MD InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir")
		For i = 1 To intRecordCount
			if i=1 Then
				ListUrl=InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClass("ClassID")
				ListPath=InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir") & "Index" & ChannelHtmlExtName
				ShowChannelList rsClass("ClassID"),True,ListPath,1
			else
				ListUrl=InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClass("ClassID") & "&Page=" & i
				ListPath=InstallDir & ChannelDir & "/" & rsClass("HtmlFileDir") & "Index_" & i & ChannelHtmlExtName
				ShowChannelList rsClass("ClassID"),True,ListPath,i
			end if
			progress int((k+1)/l*100),"共有栏目 <B><font color='red'>" & totalnumber & "</font></B> 个　正在生成第 " & k & " 个,(第 " & i & " 页) "
		Next
	rsClass.movenext
	k=k+1
	wend
	rsClass.Close:Set rsClass = Nothing
	progress int(l/l*100),"共有栏目 <B><font color='red'>" & totalnumber & "</font></B> 个　全部生成完毕! "
	Response.Write "<b>恭喜您！HTML栏目页面生成完毕!</b><br>"
	If Code_CLng(Trim(Request("ClassList")))=1 Then
		Response.Write EndTime()
		Response.Write("</ul></div>")
		Exit Sub
	End If
	id = Trim(Request("id"))
	If id = "" Then
		ErrMsg = "<li>请选择" & ChannelTit & "ID~！</li>"
		FoundErr = True 
		Exit Sub
	End If
	If Instr(id,",") >0 Then
		id=Split(id,",")
		If CLng(id(0)) < CLng(id(Ubound(id))) Then
			Tmpl=id(0)-1 & "," & id(Ubound(id))+1
		Else
			Tmpl=id(0)+1 & "," & id(Ubound(id))-1
		End If
		If Code_CLng(Trim(Request("ClassList")))=2 Then
			cSQL = "Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ID in (" & Request("id") & "," & Tmpl & ")"
		Else
			cSQL = "Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ID in (" & Tmpl & ")"
		End If
	Else
		Tmpl=id-1 & "," & id & "," & id+1
		cSQL = "Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ID in (" & Tmpl & ")"
	End If
	totalnumber = Exec("","Select Count(ID) From [" & ChannelDataName & "] "& cSQL &"",1)(0)
	i=0
	v=totalnumber+1
	Call Exec(cRs,"Select * From " & ChannelDataName & " "& cSQL &" order by ID asc",2)
	while not cRs.eof
		Ls.MD InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath)
		PaginationType=cRs("PaginationType")
		MaxCharPerPage=cRs("MaxCharPerPage")
		Select Case PaginationType
			Case 0    '不分页显示
				ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
				ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
				ShowChannelView cRs("ID"),True,ViewPath,1
				progress int((i+1)/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇 "
			Case 1    '自动分页显示
				ContentLen = Len(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1)))
				If MaxCharPerPage <= 100 Or ContentLen <= MaxCharPerPage Or InStr(LCase(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))), "<table") > 0 Or InStr(LCase(Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))), "</table>") > 0 Then
					totalPage = 1
				Else
					totalPage = ContentLen \ MaxCharPerPage
					If MaxCharPerPage * totalPage < ContentLen Then
						totalPage = totalPage + 1
					End If
				End If
				For j = 1 To totalPage
					if j=1 Then
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
						ShowChannelView cRs("ID"),True,ViewPath,1
					else
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID") & "&Page=" & j
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, j)
						ShowChannelView cRs("ID"),True,ViewPath,j
					end if
					progress int((i+1)/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇,(第 " & j & " 页) "
				Next
			Case 2    '手动分页显示
				u = 1
				strTempContent = Replace(cRs("Content"),"{$download_dir}",InstallDir & UploadSetting(1))
				strTemp = ""
				HasPageTitle = False
				regEx.MultiLine = False
				regEx.Pattern = "\[NextPage(.*?)\]"
				Set Matches = regEx.Execute(strTempContent)
				For Each Match In Matches
					If u = 1 Then
						If Match.SubMatches(0) <> "" Then
							If nohtml(Left(strTempContent, InStr(strTempContent, Match.SubMatches(0)))) <> "" Then
								strTempContent = Code_Replace(strTempContent, Match.Value, "") '去掉第一个匹配的[NextPage 分页标题]
								strTemp = "第 1 页：" & Trim(Match.SubMatches(0))
							Else
								strTemp = "第 1 页：$$$第 2 页：" & Trim(Match.SubMatches(0))
							u = u + 1
							End If
							HasPageTitle = True
						Else
							strTemp = "第 1 页：$$$第 2 页："
							u = u + 1
						End If
					Else
						If Match.SubMatches(0) <> "" Then
							strTemp = strTemp & "$$$第 " & u & " 页：" & Trim(Match.SubMatches(0))
							HasPageTitle = True
						Else
							strTemp = strTemp & "$$$第 " & u & " 页："
						End If
					End If
					u = u + 1
				Next
				regEx.MultiLine = True
				strTempContent = regEx.Replace(strTempContent, "[NextPage]")  '将[NextPage 分页标题]替换成[NextPage]
				If HasPageTitle = True Then
					strContentPageTitleArr = strTemp
				Else
					strContentPageTitleArr = ""
				End If
				Dim arrContent
				If InStr(strTempContent, "[NextPage]") <= 0 Then
					Exit Sub
				End If
				arrContent = Split(strTempContent, "[NextPage]")
				totalPage = UBound(arrContent) + 1
				If CurrentPage < 1 Then CurrentPage = 1
				If CurrentPage > totalPage Then CurrentPage = totalPage
				For u = 1 To totalPage
					if u=1 Then
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID")
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
						ShowChannelView cRs("ID"),True,ViewPath,1
					else
						ViewUrl=InstallDir & ChannelDir & "/View.asp?id=" & cRs("ID") & "&Page=" & u
						ViewPath=InstallDir & ChannelDir & "/" & Class_Path_Get(cRs("ClassID")) & ShowDatePath(cRs("HtmlFileDate"), ChannelHtmlPath) & ReadFileName(cRs("HtmlFileDate"), cRs("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, u)
						ShowChannelView cRs("ID"),True,ViewPath,u
					end if
					progress int((i+1)/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　正在生成第 " & i & " 篇,(第 " & u & " 页) "
				Next
		End Select
		Call Exec("","Update " & ChannelDataName & " Set IsUpdate=" & WK_True & " Where ID="& CLng(cRs("ID")),0)
	cRs.movenext
	i=i+1
	wend
	cRs.Close:Set cRs = Nothing
	If IsConn = False Then Call CloseConn()
	progress int(v/v*100),"共有" & ChannelTit & " <B><font color='red'>" & totalnumber & "</font></B> 篇　全部生成完毕! "
	Response.Write "<b>恭喜您！HTML浏览页面生成完毕,请返回进行其它操作!</b><br>"
	Response.Write EndTime()
	Response.Write("</ul></div>")
	Response.Write "</div>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Public Function ShowChannelIndex(IsHtml)
	Tit=ChannelName&"首页"
	Dim ListContent
	If ChannelMoban="" Then
		ChannelMoban = "Index.html"
	End If
	If ChannelSkinID="" Then
		ChannelSkinID = "DefaultSkin.css"
	End If
	HtmlContent = ChannelTemplate(ChannelMoban,ChannelSkinID,ChannelID)
	If Instr(HtmlContent,"【Repeat】") > 0 Then
	   lablez = "【Repeat】"
	Else
	   Exit Function
	End If
	regEx.Pattern = "【Repeat】([\s\S]*?)【\/Repeat】"
	Set Matches = regEx.Execute(HtmlContent)
	For Each Match In Matches
		Repeat = Match.SubMatches(0)
		HtmlContent = regEx.Replace(HtmlContent, "{$Repeat}")
		
		'得到每行显示的列数
		iCols = 1
		regEx.Pattern = "【Cols=(\d{1,2})】"
		Set Matches2 = regEx.Execute(Repeat)
		Repeat = regEx.Replace(Repeat,"")
		For Each Match2 In Matches2
			If Match2.SubMatches(0) > 1 Then iCols = Match2.SubMatches(0)
		Next
		Repeat2 = ""
		iClassID = 0
		Call Exec(rsClass,"select * from Class where ChannelID=" & ChannelID & " And ClassParent=0 Order By ClassOrder Asc,ClassID Asc",2)
		Do While Not rsClass.EOF
			ListContent = Repeat
			Cid=Int(rsClass("ClassID"))
			ClassName=rsClass("ClassName")
			If ChannelIsCreateHtml = True Then
				mores=InstallDir & ChannelDir & "/"&rsClass("HtmlFileDir")&"Index"&ChannelHtmlExtName
			Else
				mores=InstallDir & ChannelDir & "/List.asp?ClassID="&Cid
			End If
			ListContent = Replace(ListContent,"{$ClassID}",Cid)
			ListContent = Replace(ListContent,"{$ClassName}",ClassName)
			ListContent = Replace(ListContent,"{$more}",mores)
			rsClass.MoveNext
			iClassID = iClassID + 1
			If iClassID Mod iCols = 0 And Not rsClass.EOF Then
				Repeat2 = Repeat2 & ListContent
				If iCols > 1 Then Repeat2 = Repeat2 & "</tr><tr>"
			Else
				Repeat2 = Repeat2 & ListContent
				If iCols > 1 Then Repeat2 = Repeat2 & "<td width='5'></td>"
			End If
		Loop
		rsClass.Close
		Set rsClass = Nothing
		HtmlContent = Replace(HtmlContent, "{$Repeat}", Repeat2)
	Next
	HtmlContent = Replace(HtmlContent,"{$ClassID}",Cid)
	HtmlContent = Replace(HtmlContent,"{$ListNum}",CLng(ChannelListNum(0)))
	HtmlContent = Replace(HtmlContent,"{$CuteNum}",CLng(ChannelCuteNum(0)))
	HtmlContent = Replace(HtmlContent,"{$ChannelID}",ChannelID)
	HtmlContent = Replace(HtmlContent,"{$ChannelTit}",ChannelTit)
	HtmlContent = Replace(HtmlContent,"{$ChannelDir}",ChannelDir)
	HtmlContent = Replace(HtmlContent,"{$ChannelName}",ChannelName)
	HtmlContent = Replace(HtmlContent,"{$ChannelUnit}",ChannelUnit)
	HtmlContent = ReplaceHtml(HtmlContent)
	HtmlContent = Html.ReadClass(HtmlContent)
	HtmlContent = Html.ReadClassName(HtmlContent)
	HtmlContent = Html.ReadChannelList(HtmlContent)
	HtmlContent = Html.ReadChannelPic(HtmlContent)
	HtmlContent = Html.ReadChannelFlash(HtmlContent)
	HtmlContent = Html.ReadChannelFlashqq(HtmlContent)
	HtmlContent = ReHtml(HtmlContent)
	If IsHtml=True Then
		ShowChannelIndex = HtmlContent
	Else
		Response.Write HtmlContent
	End If
End Function

Public Function ShowChannelList(Cid,IsHtml,ListPath,CurrentPage)
	Tit=ChannelTit&"列表"&ShowTit(Cid)
	Dim ListContent
	if Cid = "" Then
		Response.End()
	End if
	If ChannelIsCreateHtml = True Then
		ChannelIndexFile = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	Else
		ChannelIndexFile = InstallDir & ChannelDir & "/Index.asp"
	End If
	sqlClass = "select * from Class where ChannelID=" & ChannelID & " And ClassID=" & Cid & " Order By ClassOrder Asc,ClassID Asc"
	Call Exe_Conn(rsClass,sqlClass,1)
	If rsClass.eof And rsClass.bof Then
		Response.End()
	Else
		ClassNames = rsClass("ClassName")
		ImageWidth = rsClass("ImageWidth")
		ImageHeight = rsClass("ImageHeight")
		CuteNums  =  rsClass("CuteNums")
		Columns = rsClass("Columns")
		PageNum = rsClass("PageNum")
		HtmlFileDir = rsClass("HtmlFileDir")
		ClassChildStr = rsClass("ClassChildStr")
		ClassPic = rsClass("ClassPic")
		MetaKeyWord = rsClass("MetaKeyWord")
		MetaDescript = rsClass("MetaDescript")
		Mobanid = rsClass("Moban")
		Skinid = rsClass("SkinID")
		TemplateID = rsClass("TemplateID")
		StrShowPath = "·您的位置：<a href='"&IndexFile&"' class='LinkPath'>本站首页</a>&nbsp;&gt;&nbsp;<a href='"&ChannelIndexFile&"' class='LinkPath'>"&ChannelTit&"首页</a>"&ShowPath(Cid)
		rsClass.Close
		Set rsClass = Nothing
	End If
	If Trim(Request("MaxPerPage"))<>"" Then
		MaxPerPage = Code_CLng(Trim(Request("MaxPerPage")))
	Else
		If Is_Null(PageNum) = "" Or PageNum = 0 Then
			MaxPerPage = CLng(ChannelListNum(1))
		Else
			MaxPerPage = CLng(PageNum)
		End If
	End If
	If MaxPerPage <= 0 Then MaxPerPage = 20
	If Mobanid="" Then
		Mobanid = "List.html"
	End If
	If Skinid="" Then
		Skinid = "DefaultSkin.css"
	End If
	HtmlContent = ChannelTemplate(Mobanid,Skinid,ChannelID)
	If Instr(HtmlContent,"[Repeat]") > 0 Then
	   lablez = "[Repeat]"
	Else
	   Exit Function
	End If
	ListContent = CutFixContent(HtmlContent,lablez,"[/Repeat]",0)
	If ChannelIsCreateHtml = True Then
		ChannelIndexFile = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
		mores = InstallDir & ChannelDir & "/" & HtmlFileDir & "Index" & ChannelHtmlExtName
	Else
		ChannelIndexFile = InstallDir & ChannelDir & "/Index.asp"
		mores = InstallDir & ChannelDir & "/List.asp?ClassID=" & Cid
	End If
	sqlList = "Select * From " & ChannelDataName & " Where ChannelID=" & ChannelID & " and Hidden=" & WK_True & " And IsDelete=" & WK_False
	if ClassChildStr<>0 Then sqlList=sqlList&" and ClassID in (" & ClassChildStr & ")"
	sqlList=sqlList&" Order By OrderID Desc,ID Desc"
	Call Exe_Conn(rsList,sqlList,1)
	If rsList.BOF And rsList.EOF Then
		rsList.Close
		Set rsList = Nothing
		ListContents="对不起，没有任何" & ChannelTit & "！"
	Else
		totalPut = rsList.RecordCount
		If CurrentPage < 1 Then
			CurrentPage = 1
		End If
		If (CurrentPage - 1) * MaxPerPage > totalPut Then
			If (totalPut Mod MaxPerPage) = 0 Then
				CurrentPage = totalPut \ MaxPerPage
			Else
				CurrentPage = totalPut \ MaxPerPage + 1
			End If
		End If
		If CurrentPage > 1 Then
			If (CurrentPage - 1) * MaxPerPage < totalPut Then
				rsList.Move (CurrentPage - 1) * MaxPerPage
			Else
				CurrentPage = 1
			End If
		End If
		ji=1
		ListContents=ListContents&"<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & VbCrlf
		Do While Not rsList.EOF
			sqlClassList="select * from Class where ChannelID=" & ChannelID & " And ClassID=" & rsList("ClassID") & " Order By ClassID,ClassOrder,ClassDepth Asc"
			Call Exe_Conn(rsClassList,sqlClassList,1)
			If rsClassList.eof And rsClassList.bof Then
				ClassName=""
			Else
				ClassAlt = rsClassList("ClassName")
				ClassName = rsClassList("ClassName")
				If ChannelIsCreateHtml = True Then
					ClassUrl = InstallDir & ChannelDir & "/" & rsClassList("HtmlFileDir") & "Index" & ChannelHtmlExtName
				Else
					ClassUrl = InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClassList("ClassID")
				End If
			End If
			If ChannelIsCreateHtml = True Then
				HtmlFileName = ReadFileName(rsList("HtmlFileDate"), rsList("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
				HtmlFileUrl = InstallDir & ChannelDir & "/" & rsClassList("HtmlFileDir") & ShowDatePath(rsList("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName
			Else
				HtmlFileUrl = InstallDir & ChannelDir & "/View.asp?id=" & rsList("ID")
			End If
			rsClassList.Close
			Set rsClassList = Nothing
			Hits="<span id=""Hits""><script type=""text/javascript"">posthtm('" & InstallDir & ChannelDir & "/Hits.asp?Action=List&Hits=Hits','Hits','id=" & Vid & "');</script></span>"
			sTopic = GetIncInfo(rsList("IncludeInfo"))
			If ChannelIsCreateHtml = True Then
				sTitleAlt = ChannelTit & "标题：" & rsList("Title") & "&#13;&#10;发布时间：" & rsList("Tim")
			Else
				sTitleAlt = ChannelTit & "标题：" & rsList("Title") & "&#13;&#10;发布时间：" & rsList("Tim") & "&#13;&#10;阅览次数：" & rsList("Hits")
			End If
			If CLng(CuteNums) > 1 Then
				CuteNums = CuteNums
			Else
				CuteNums = ChannelCuteNum(1)
			End If
			If CLng(CuteNums)<>0 Then
				sTitle = Cuted(rsList("Title"), CLng(CuteNums))
			Else
				sTitle = rsList("Title")
			End If
			sTitle = GetTcolor(sTitle,rsList("Tcolor"),False)
			If rsList("Pic")<>"" Then
				Pic=rsList("Pic")
				Pic=Replace(Pic,"{$download_dir}",InstallDir & UploadSetting(1))
				Pic="<img src='" & Pic & "' width='" & ImageWidth & "' height='" & ImageHeight & "' border='0' />"
			Else
				Pic=InstallDir & "Images/no_pic.png"
				Pic=Replace(Pic,"{$download_dir}",InstallDir & UploadSetting(1))
				Pic="<img src='" & Pic & "' width='" & ImageWidth & "' height='" & ImageHeight & "' border='0' />"
			End If
			if ((ji-1) mod Columns = 0) Then ListContents=ListContents&"<tr>" & VbCrlf
			ListContents=ListContents&"<td width='*'>"
			ListContents=ListContents&ListContent
			ListContents=Replace(ListContents,"{$ClassUrl}",ClassUrl)
			ListContents=Replace(ListContents,"{$ClassAlt}",ClassAlt)
			ListContents=Replace(ListContents,"{$ClassName}",ClassName)
			ListContents=Replace(ListContents,"{$Topic}",sTopic)
			ListContents=Replace(ListContents,"{$Pic}",Pic)
			ListContents=Replace(ListContents,"{$TitleAlt}",sTitleAlt)
			ListContents=Replace(ListContents,"{$TitleUrl}",HtmlFileUrl)
			'替换{$Intro(InfoLength)}标签
			Dim strIntro
			regEx.Pattern = "\{\$Intro\((.*?)\)\}"
			Set Matches = regEx.Execute(ListContents)
			For Each Match In Matches
				arrTemp = Split(Match.SubMatches(0), ",")
				If UBound(arrTemp) <> 0 Then
					strIntro= "函数式标签：{$Intro(参数列表)}的参数个数不对。请检查模板中的此标签。"
			
				Else
					If Code_CLng(arrTemp(0))>0 then
						strIntro = GetSubStr(NoHtml(rsList("Intro")),Code_CLng(arrTemp(0)),False)
					Else
						strIntro = NoHtml(rsList("Intro"))
					End IF
				End If
				ListContents = Replace(ListContents, Match.Value, strIntro)
			Next
			'替换{$Content(InfoLength)}标签
			Dim strContent
			regEx.Pattern = "\{\$Content\((.*?)\)\}"
			Set Matches = regEx.Execute(ListContents)
			For Each Match In Matches
				arrTemp = Split(Match.SubMatches(0), ",")
				If UBound(arrTemp) <> 0 Then
					strContent= "函数式标签：{$Content(参数列表)}的参数个数不对。请检查模板中的此标签。"
			
				Else
					If Code_CLng(arrTemp(0))>0 then
						strContent = GetSubStr(NoHtml(rsList("Content")),Code_CLng(arrTemp(0)),False)
					Else
						strContent = NoHtml(rsList("Content"))
					End IF
				End If
				ListContents = Replace(ListContents, Match.Value, strContent)
			Next
			labelRuleField = "\{\$([\s\S]*?)\}"
			regEx.Pattern = labelRuleField
			Set Matches = regEx.Execute(ListContents)
			For Each Match In Matches
				fieldNameArr = RegExpReplace(Match.SubMatches(0),"[\s]+",chr(32))
				fieldNameArr = trim(fieldNameArr)
				m = instr(fieldNameArr,chr(32))
				If  m > 0 then
					fieldName = left(fieldNameArr,m - 1)
					fieldArr = right(fieldNameArr,len(fieldNameArr) - m)
				Else
					fieldName = fieldNameArr
					fieldArr = ""
				End If
				Select Case fieldName
				Case "Title"
					namelen = ParseArr(fieldArr)("len")
					if not IsNul(namelen) then
						namelen=cint(namelen)
						if len(sTitle)>namelen then sTitle=GetSubStr(sTitle,namelen,False)
					end if
						ListContents = Replace(ListContents,Match.value,sTitle)
				Case "Date"
					timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
					Select Case timestyle
						Case "yy-m-d"
							ListContents = Replace(ListContents,Match.value,FormatDate(rsList("Tim"),1))
						Case "y-m-d"
							ListContents = Replace(ListContents,Match.value,FormatDate(rsList("Tim"),2))
						Case "m-d"
							ListContents = Replace(ListContents,Match.value,FormatDate(rsList("Tim"),3))
						Case "yy/m/d"
							ListContents = Replace(ListContents,Match.value,FormatDate(rsList("Tim"),9))
						Case "y/m/d"
							ListContents = Replace(ListContents,Match.value,FormatDate(rsList("Tim"),10))
						Case "m/d"
							ListContents = Replace(ListContents,Match.value,FormatDate(rsList("Tim"),11))
					End Select
				Case fieldName
					SqlFieldSet = "SELECT * FROM [FieldSet] WHERE Field='"& fieldName &"' AND ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
					Call Exec(RsFieldSet,SqlFieldSet,2)
					If RsFieldSet.BOF And RsFieldSet.EOF Then
						RsFieldSet.Close
						Set RsFieldSet = Nothing
					Else
						Pv_FieldType = RsFieldSet("FieldType")
						RsFieldSet.Close
						Set RsFieldSet = Nothing
						namelen = ParseArr(fieldArr)("len")
						sfieldName = rsList(fieldName)
						if not IsNul(sfieldName) then
							If Pv_FieldType="checkbox" Then
								ListContents = Replace(ListContents,Match.value,left(sfieldName,len(sfieldName)-1))
							Else
								if not IsNul(namelen) then
									namelen=cint(namelen)
									if len(sfieldName)>namelen then sfieldName=GetSubStr(sfieldName,namelen,False)
								end if
								ListContents = Replace(ListContents,Match.value,sfieldName)
							End If
						else
							ListContents = Replace(ListContents,Match.value,"")
						end if
					End If
				End Select
			Next
			Set Matches = nothing
			ListContents=Replace(ListContents,"{$Intro}",rsList("Intro"))
			ListContents=Replace(ListContents,"{$Content}",rsList("Content"))
			ListContents=Replace(ListContents,"{$Hits}",Hits)
			ListContents=Replace(ListContents,"{$Keyes}",rsList("Keyes"))
			ListContents=Replace(ListContents,"{$Inputer}",rsList("Inputer"))
			ListContents=Replace(ListContents,"{$Author}",rsList("Author"))
			ListContents=Replace(ListContents,"{$Subtitle}",rsList("Subtitle"))
			ListContents=Replace(ListContents,"{$Subheading}",rsList("Subheading"))
			Sql="select * from CopyFrom where ChannelID=" & ChannelID & " and SourceName='" & rsList("CopyFrom") & "'"
			Call Exe_Conn(Rs,Sql,3)
			If Rs.BOF And Rs.EOF Then
				Rs.Close
				Set Rs = Nothing
				CopyFrom = "<a href=""" & SiteUrl & """ target=""_blank"">" & rsList("CopyFrom") & "</a>"
			Else
				CopyFrom = "<a href=""" & Rs("SourceUrl") & """ target=""_blank"">" & Rs("SourceName") & "</a>"
				Rs.Close
				Set Rs = Nothing
			End If
			ListContents=Replace(ListContents,"{$CopyFrom}",CopyFrom)
			ListContents=ListContents&"</td>" & VbCrlf
			if (ji mod Columns = 0) Then ListContents=ListContents&"</tr>" & VbCrlf
			ji=ji+1
			iCount = iCount + 1
			If iCount >= MaxPerPage Then Exit Do
			rsList.MoveNext
		Loop
		rsList.Close
		Set rsList = Nothing
		if totalPut < Columns Then ListContents=ListContents&"</tr>" & VbCrlf
		if (totalPut mod Columns = 1) Then ListContents=ListContents&"</tr>" & VbCrlf
		ListContents=ListContents&"</table>"
		If ChannelIsCreateHtml = True Then
			Body=ShowPage_Html(InstallDir & ChannelDir & "/" & HtmlFileDir, 0, ChannelHtmlExtName, "", totalPut, MaxPerPage, CurrentPage, True, True, ChannelUnit & ChannelTit)
		Else
			Body=ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, ChannelUnit & ChannelTit, True)
		End If
	End If
	HtmlContent = Replace(HtmlContent,lablez & ListContent&"[/Repeat]",ListContents)
	HtmlContent = Replace(HtmlContent,"{$ClassID}",Cid)
	HtmlContent = Replace(HtmlContent,"{$more}",mores)
	HtmlContent = Replace(HtmlContent,"{$ClassName}", ClassNames)
	HtmlContent = Replace(HtmlContent,"{$ShowPage}",Body)
	HtmlContent = Replace(HtmlContent,"{$ChannelID}",ChannelID)
	HtmlContent = Replace(HtmlContent,"{$ChannelTit}",ChannelTit)
	HtmlContent = Replace(HtmlContent,"{$ChannelDir}",ChannelDir)
	HtmlContent = Replace(HtmlContent,"{$ChannelName}",ChannelName)
	HtmlContent = Replace(HtmlContent,"{$ChannelUnit}",ChannelUnit)
	if not IsNul(MetaKeyWord) then
		HtmlContent = Replace(HtmlContent,"{$MetaKeyWord}",MetaKeyWord)
	else
		HtmlContent = Replace(HtmlContent,"{$MetaKeyWord}","")
	end if
	if not IsNul(MetaDescript) then
		HtmlContent = Replace(HtmlContent,"{$MetaDescript}",MetaDescript)
	else
		HtmlContent = Replace(HtmlContent,"{$MetaDescript}","")
	end if
	HtmlContent = ReplaceHtml(HtmlContent)
	HtmlContent = Html.ReadClass(HtmlContent)
	HtmlContent = Html.ReadClassName(HtmlContent)
	HtmlContent = Html.ReadChannelList(HtmlContent)
	HtmlContent = Html.ReadChannelPic(HtmlContent)
	HtmlContent = Html.ReadChannelFlash(HtmlContent)
	HtmlContent = Html.ReadChannelFlashqq(HtmlContent)
	HtmlContent = ReHtml(HtmlContent)
	If IsHtml=True Then
		ShowChannelList = HtmlContent
	Else
		Response.Write HtmlContent
	End If
	WriteTOFile ListPath,HtmlContent
	ListContents = ""
	HtmlContent = ""
	HtmlContent = ""
End Function

Public Function ShowChannelView(Vid,IsHtml,ViewPath,CurrentPage)
	Dim StrUploadFilesUrl
	if Vid="" Then
		Response.End()
	End if
	If ChannelIsCreateHtml = True Then
		ChannelIndexFile = InstallDir & ChannelDir & "/Index" & ChannelHtmlExtName
	Else
		ChannelIndexFile = InstallDir & ChannelDir & "/Index.asp"
	End If
	sqlView = "Select * From " & ChannelDataName & " Where ChannelID=" & ChannelID & " and Hidden=" & WK_True & " And IsDelete=" & WK_False & " and id=" & Vid & " Order By OrderID Desc,ID Desc"
	Call Exe_Conn(rsView,sqlView,1)
	If rsView.BOF And rsView.EOF Then
		rsView.Close
		Set rsView = Nothing
		Call Format_Redirect(ChannelIndexFile)
		Response.End()
	Else
		Cid = rsView("ClassID")
		Title = rsView("Title")
		SEOTitle = rsView("SEOTitle")
		SEOKeyWord = rsView("SEOKeyWord")
		SEODescript = rsView("SEODescript")
		Mobanid = rsView("Moban")
		Skinid = rsView("SkinID")
		TemplateID = rsView("TemplateID")
		StrShowPath = "·您的位置：<a href='"&IndexFile&"' class='LinkPath'>本站首页</a>&nbsp;&gt;&nbsp;<a href='"&ChannelIndexFile&"' class='LinkPath'>"&ChannelTit&"首页</a>"&ShowPath(Cid)&"&nbsp;&gt;&nbsp;"&Title&""
		rsView.Close
		Set rsView = Nothing
	End If
	Tit=ChannelTit&"浏览"&ShowTit(Cid)&" - "&Title
	If Mobanid="" Then
		Mobanid = "View.html"
	End If
	If Skinid="" Then
		Skinid = "DefaultSkin.css"
	End If
	'Call Exec("","Update " & ChannelDataName & " Set Hits=Hits+1 Where ChannelID=" & ChannelID & " and Hidden=" & WK_True & " And IsDelete=" & WK_False & " and id=" & Vid,0)
	sqlView = "Select * From " & ChannelDataName & " Where ChannelID=" & ChannelID & " and Hidden=" & WK_True & " And IsDelete=" & WK_False & " and id=" & Vid & " Order By ClassID,OrderID,ID Asc"
	Call Exe_Conn(rsView,sqlView,1)
	If rsView.BOF And rsView.EOF Then
		rsView.Close
		Set rsView = Nothing
		Response.End()
	Else
		sqlClassView="select * from Class where ChannelID=" & ChannelID & " And ClassID=" & rsView("ClassID") & " Order By ClassID,ClassOrder,ClassDepth Asc"
		Call Exe_Conn(rsClassView,sqlClassView,1)
		If rsClassView.eof And rsClassView.bof Then
			ClassName = ""
		Else
			Cid = rsClassView("ClassID")
			HtmlFileDir = rsClassView("HtmlFileDir")
			ClassAlt = rsClassView("ClassName")
			ClassName = rsClassView("ClassName")
			If ChannelIsCreateHtml = True Then
				ClassUrl = InstallDir & ChannelDir & "/" & HtmlFileDir & "Index" & ChannelHtmlExtName
			Else
				ClassUrl = InstallDir & ChannelDir & "/List.asp?ClassID=" & rsClassView("ClassID")
			End If
			rsClassView.Close
			Set rsClassView = Nothing
		End If
		If ChannelIsCreateHtml = True Then
			HtmlFileName = ReadFileName(rsView("HtmlFileDate"), rsView("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
			HtmlFileUrl = InstallDir & ChannelDir & "/" & HtmlFileDir & ShowDatePath(rsView("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName
		Else
			HtmlFileUrl = InstallDir & ChannelDir & "/View.asp?id=" & rsView("ID")
		End If
		Cid = rsView("ClassID")
		sTopic = GetIncInfo(rsView("IncludeInfo"))
		If ChannelIsCreateHtml = True Then
			sTitleAlt = ChannelTit & "标题：" & rsView("Title") & "&#13;&#10;发布时间：" & rsView("Tim")
		Else
			sTitleAlt = ChannelTit & "标题：" & rsView("Title") & "&#13;&#10;发布时间：" & rsView("Tim") & "&#13;&#10;阅览次数：" & rsView("Hits")
		End If
		If CLng(ChannelCuteNum(2))<>0 Then
			sTitle = Cuted(rsView("Title"), ChannelCuteNum(2))
		Else
			sTitle = rsView("Title")
		End If
		sTitle = GetTcolor(sTitle,rsView("Tcolor"),False)
		PageTitle = rsView("PageTitle")
		If rsView("UploadFiles")<>"" Then
			StrUploadFilesUrl=Trim(rsView("UploadFiles"))
			if Instr(StrUploadFilesUrl,"@@@") >0 Then
				StrUploadFilesUrl=Split(StrUploadFilesUrl,"@@@")
				for i=0 to Ubound(StrUploadFilesUrl)
					Pic=Pic&"<img src='" & Replace(StrUploadFilesUrl(i),"{$download_dir}",InstallDir & UploadSetting(1)) & "' width='" & ChannelPicWidth & "' height='" & ChannelPicHeight & "' border='0' />"
				Next
			else
				Pic="<img src='" & Replace(StrUploadFilesUrl,"{$download_dir}",InstallDir & UploadSetting(1)) & "' width='" & ChannelPicWidth & "' height='" & ChannelPicHeight & "' border='0' />"
			end if
		Else
			Pic=""
		End If
		PaginationType=rsView("PaginationType")
		MaxCharPerPage=rsView("MaxCharPerPage")
		If rsView("LinkUrl") <> "" And rsView("LinkUrl") <> "http://" Then
			Content="<script type='text/javascript'>window.location.href='" & rsView("LinkUrl") & "';</script>"
		Else
			Select Case PaginationType
				Case 0    '不分页显示
					Content=Replace(rsView("Content"),"{$download_dir}",InstallDir & UploadSetting(1))
				Case 1    '自动分页显示
					strTempContent=Replace(rsView("Content"),"{$download_dir}",InstallDir & UploadSetting(1))
					Dim lContent, ContentLen, MaxPerPage, lngBound
					Dim BeginPoint, EndPoint
					ContentLen = Len(strTempContent)
					If MaxCharPerPage <= 100 Or ContentLen <= MaxCharPerPage Or InStr(LCase(strTempContent), "<table") > 0 Or InStr(LCase(strTempContent), "</table>") > 0 Then
						Content = strTempContent & "</p>"
						Exit Function
					End If
					lContent = LCase(strTempContent)
					If InStr(lContent, "<table") > 0 And InStr(lContent, "</table>") > 0 Then
						Content = strTempContent & "</p>"
						Exit Function
					End If
					totalPage = ContentLen \ MaxCharPerPage
					If MaxCharPerPage * totalPage < ContentLen Then
						totalPage = totalPage + 1
					End If
					If CurrentPage < 1 Then CurrentPage = 1
					If CurrentPage > totalPage Then CurrentPage = totalPage
					If CurrentPage = 1 Then
						BeginPoint = 1
					Else
						BeginPoint = MaxCharPerPage * (CurrentPage - 1)
						BeginPoint = GetSpecialPosition(strTempContent, BeginPoint, MaxCharPerPage) '防止把拆分Html代码，返回新的位置
					End If
					If CurrentPage = totalPage Then
						EndPoint = ContentLen
					Else
						EndPoint = MaxCharPerPage * CurrentPage
						If EndPoint >= ContentLen Then
							EndPoint = ContentLen
						Else
							EndPoint = GetSpecialPosition(strTempContent, EndPoint, MaxCharPerPage)
						End If
					End If
					If EndPoint < BeginPoint Then EndPoint = BeginPoint
					Content = Mid(strTempContent, BeginPoint, EndPoint - BeginPoint) & "</p>" & GetContentPages(totalPage, CurrentPage, HtmlFileUrl)
				Case 2    '手动分页显示
					strTempContent=Replace(rsView("Content"),"{$download_dir}",InstallDir & UploadSetting(1))
					Dim strTemp
					Dim i
					Dim HasPageTitle
					i = 1
					strTemp = ""
					HasPageTitle = False
					regEx.MultiLine = False
					regEx.Pattern = "\[NextPage(.*?)\]"
					Set Matches = regEx.Execute(strTempContent)
					For Each Match In Matches
						If i = 1 Then
							If Match.SubMatches(0) <> "" Then
								If NoHtml(Left(strTempContent, InStr(strTempContent, Match.SubMatches(0)))) <> "" Then
									strTempContent = Code_Replace(strTempContent, Match.Value, "") '去掉第一个匹配的[NextPage 分页标题]
									strTemp = "第 1 页：" & Trim(Match.SubMatches(0))
								Else
									strTemp = "第 1 页：$$$第 2 页：" & Trim(Match.SubMatches(0))
								i = i + 1
								End If
								HasPageTitle = True
							Else
								strTemp = "第 1 页：$$$第 2 页："
								i = i + 1
							End If
						Else
							If Match.SubMatches(0) <> "" Then
								strTemp = strTemp & "$$$第 " & i & " 页：" & Trim(Match.SubMatches(0))
								HasPageTitle = True
							Else
								strTemp = strTemp & "$$$第 " & i & " 页："
							End If
						End If
						i = i + 1
					Next
					regEx.MultiLine = True
					strTempContent = regEx.Replace(strTempContent, "[NextPage]")  '将[NextPage 分页标题]替换成[NextPage]
					If HasPageTitle = True Then
						strContentPageTitleArr = strTemp
					Else
						strContentPageTitleArr = ""
					End If
					Dim arrContent
					If InStr(strTempContent, "[NextPage]") <= 0 Then
						Content = strTempContent & "</p>"
						Exit Function
					End If
					arrContent = Split(strTempContent, "[NextPage]")
					totalPage = UBound(arrContent) + 1
					If CurrentPage < 1 Then CurrentPage = 1
					If CurrentPage > totalPage Then CurrentPage = totalPage
					Content = arrContent(CurrentPage - 1) & "</p>" & GetContentPages(totalPage, CurrentPage, HtmlFileUrl)
			End Select
		End If
		Tim=rsView("Tim")
		Hits="<span id=""Hits""><script type=""text/javascript"">posthtm('" & InstallDir & ChannelDir & "/Hits.asp?Hits=Hits','Hits','id=" & Vid & "');</script></span>"
		Keyes=rsView("Keyes")
		Inputer=rsView("Inputer")
		Author=rsView("Author")
		Subtitle=rsView("Subtitle")
		Subheading=rsView("Subheading")
		Sql="select * from CopyFrom where ChannelID=" & ChannelID & " and SourceName='" & rsView("CopyFrom") & "'"
		Call Exe_Conn(Rs,Sql,3)
		If Rs.BOF And Rs.EOF Then
			Rs.Close
			Set Rs = Nothing
			CopyFrom = "<a href=""" & SiteUrl & """ target=""_blank"">" & rsView("CopyFrom") & "</a>"
		Else
			CopyFrom = "<a href=""" & Rs("SourceUrl") & """ target=""_blank"">" & Rs("SourceName") & "</a>"
			Rs.Close
			Set Rs = Nothing
		End If
		ContentArr=rsView("Content")
		Intro=rsView("Intro")
		HtmlFileDate=rsView("HtmlFileDate")
		SqlFieldSet = "SELECT * FROM [FieldSet] WHERE ChannelID="& ChannelID &" AND Recycle<>1 ORDER BY OrderNum ASC"
		Call Exec(RsFieldSet,SqlFieldSet,2)
		Do While Not(RsFieldSet.Eof)
			Pv_Field = RsFieldSet("Field")
			If RsFieldSet("FieldType")="checkbox" Then
				HtmlContent = Replace(HtmlContent,"{$" & Pv_Field & "}",left(rsView(Pv_Field),len(rsView(Pv_Field))-1))
			Else
				HtmlContent = Replace(HtmlContent,"{$" & Pv_Field & "}",rsView(Pv_Field))
			End If
			RsFieldSet.MoveNext
		Loop
		sqlUpView="select * from " & ChannelDataName & " where ChannelID=" & ChannelID & " And ClassID=" & rsView("ClassID") & " And id<" & Vid & " and Hidden=" & WK_True & " And IsDelete=" & WK_False & " Order By id Desc"
		Call Exe_Conn(rsUpView,sqlUpView,1)
		If rsUpView.eof And rsUpView.bof Then
			About_Up = "上一" & ChannelUnit & ChannelTit & "：没有找到上一" & ChannelUnit
		Else
			If ChannelIsCreateHtml = True Then
				HtmlFileName = ReadFileName(rsUpView("HtmlFileDate"), rsUpView("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
				About_Up = "上一" & ChannelUnit & ChannelTit & "：<a href='" & InstallDir & ChannelDir & "/" & HtmlFileDir & ShowDatePath(rsUpView("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName & "'>" & rsUpView("Title") & "</a>"
			Else
				About_Up = "上一" & ChannelUnit & ChannelTit & "：<a href='" & InstallDir & ChannelDir & "/View.asp?id=" & rsUpView("ID") & "'>" & rsUpView("Title") & "</a>"
			End If
			rsUpView.Close
			Set rsUpView = Nothing
		End If
		sqlDownView="select * from " & ChannelDataName & " where ChannelID=" & ChannelID & " And ClassID=" & rsView("ClassID") & " And id>" & Vid & " and Hidden=" & WK_True & " And IsDelete=" & WK_False & " Order By id Asc"
		Call Exe_Conn(rsDownView,sqlDownView,1)
		If rsDownView.eof And rsDownView.bof Then
			About_Down = "下一" & ChannelUnit & ChannelTit & "：没有找到下一" & ChannelUnit
		Else
			If ChannelIsCreateHtml = True Then
				HtmlFileName = ReadFileName(rsDownView("HtmlFileDate"), rsDownView("ID"), ChannelHtmlExtName, ChannelHtmlPrefix, ChannelHtmlForm, "")
				About_Down = "下一" & ChannelUnit & ChannelTit & "：<a href='" & InstallDir & ChannelDir & "/" & HtmlFileDir & ShowDatePath(rsDownView("HtmlFileDate"), ChannelHtmlPath) & HtmlFileName & "'>" & rsDownView("Title") & "</a>"
			Else
				About_Down = "下一" & ChannelUnit & ChannelTit & "：<a href='" & InstallDir & ChannelDir & "/View.asp?id=" & rsDownView("ID") & "'>" & rsDownView("Title") & "</a>"
			End If
			rsDownView.Close
			Set rsDownView = Nothing
		End If
		rsView.Close
		Set rsView = Nothing
	End If
	HtmlContent = ChannelTemplate(Mobanid,Skinid,ChannelID)
	HtmlContent = Replace(HtmlContent,"{$ClassID}",Cid)
	HtmlContent = Replace(HtmlContent,"{$more}",mores)
	HtmlContent = Replace(HtmlContent,"{$ClassUrl}",ClassUrl)
	HtmlContent = Replace(HtmlContent,"{$ClassAlt}",ClassAlt)
	HtmlContent = Replace(HtmlContent,"{$ClassName}", ClassName)
	HtmlContent = Replace(HtmlContent,"{$Topic}",sTopic)
	labelRuleField = "\{\$([\s\S]*?)\}"
	regEx.Pattern = labelRuleField
	Set Matches = regEx.Execute(HtmlContent)
	For Each Match In Matches
		fieldNameArr = RegExpReplace(Match.SubMatches(0),"[\s]+",chr(32))
		fieldNameArr = trim(fieldNameArr)
		m = instr(fieldNameArr,chr(32))
		If  m > 0 then
			fieldName = left(fieldNameArr,m - 1)
			fieldArr = right(fieldNameArr,len(fieldNameArr) - m)
		Else
			fieldName = fieldNameArr
			fieldArr = ""
		End If
		Select Case fieldName
		Case "Title"
			namelen = ParseArr(fieldArr)("len")
			if not IsNul(namelen) then
				namelen=cint(namelen)
				if len(sTitle)>namelen then sTitle=GetSubStr(sTitle,namelen,False)
			end if
			if PaginationType=1 Or PaginationType=2 then
				arrContent = Split(ContentArr, "[NextPage]")
				For I = 0 To UBound(arrContent)
					If Not IsNul(PageTitle) Then
						PageTitleArr=Split(PageTitle,"§")
						If CurrentPage-1<=Ubound(PageTitleArr) Then
							HtmlContent = Replace(HtmlContent,Match.value,PageTitleArr(CurrentPage-1))
						Else
							HtmlContent = Replace(HtmlContent,Match.value,sTitle)
						End If
					Else
							HtmlContent = Replace(HtmlContent,Match.value,sTitle)
					End IF
				Next
			else
				HtmlContent = Replace(HtmlContent,Match.value,sTitle)
			end if
		Case "Date"
			timestyle = ParseArr(fieldArr)("style") : if IsNul(timestyle) then timestyle = "m-d"
			Select Case timestyle
				Case "yy-m-d"
					HtmlContent = Replace(HtmlContent,Match.value,FormatDate(Tim,1))
				Case "y-m-d"
					HtmlContent = Replace(HtmlContent,Match.value,FormatDate(Tim,2))
				Case "m-d"
					HtmlContent = Replace(HtmlContent,Match.value,FormatDate(Tim,3))
				Case "yy/m/d"
					HtmlContent = Replace(HtmlContent,Match.value,FormatDate(Tim,9))
				Case "y/m/d"
					HtmlContent = Replace(HtmlContent,Match.value,FormatDate(Tim,10))
				Case "m/d"
					HtmlContent = Replace(HtmlContent,Match.value,FormatDate(Tim,11))
			End Select
		End Select
	Next
	Set Matches = nothing
	HtmlContent = Replace(HtmlContent,"{$Pic}",Pic)
	HtmlContent = Replace(HtmlContent,"{$TitleAlt}",sTitleAlt)
	HtmlContent = Replace(HtmlContent,"{$TitleUrl}",HtmlFileUrl)
	'替换{$Intro(InfoLength)}标签
	Dim strIntro
	regEx.Pattern = "\{\$Intro\((.*?)\)\}"
	Set Matches = regEx.Execute(HtmlContent)
	For Each Match In Matches
		arrTemp = Split(Match.SubMatches(0), ",")
		If UBound(arrTemp) <> 0 Then
			strIntro= "函数式标签：{$Intro(参数列表)}的参数个数不对。请检查模板中的此标签。"
	
		Else
			If Code_CLng(arrTemp(0))>0 then
				strIntro = GetSubStr(NoHtml(Intro),Code_CLng(arrTemp(0)),False)
			Else
				strIntro = NoHtml(Intro)
			End IF
		End If
		HtmlContent = Replace(HtmlContent, Match.Value, strIntro)
	Next
	'替换{$Content(InfoLength)}标签
	Dim strContent
	regEx.Pattern = "\{\$Content\((.*?)\)\}"
	Set Matches = regEx.Execute(HtmlContent)
	For Each Match In Matches
		arrTemp = Split(Match.SubMatches(0), ",")
		If UBound(arrTemp) <> 0 Then
			strContent= "函数式标签：{$Content(参数列表)}的参数个数不对。请检查模板中的此标签。"
	
		Else
			If Code_CLng(arrTemp(0))>0 then
				strContent = GetSubStr(NoHtml(Content),Code_CLng(arrTemp(0)),False)
			Else
				strContent = NoHtml(Content)
			End IF
		End If
		HtmlContent = Replace(HtmlContent, Match.Value, strContent)
	Next
	HtmlContent = Replace(HtmlContent,"{$Intro}",Intro)
	HtmlContent = Replace(HtmlContent,"{$Content}",Content)
	HtmlContent = Replace(HtmlContent,"{$Hits}",Hits)
	HtmlContent = Replace(HtmlContent,"{$Keyes}",Keyes)
	HtmlContent = Replace(HtmlContent,"{$Inputer}",Inputer)
	HtmlContent = Replace(HtmlContent,"{$Author}",Author)
	HtmlContent = Replace(HtmlContent,"{$Subtitle}",Subtitle)
	HtmlContent = Replace(HtmlContent,"{$Subheading}",Subheading)
	HtmlContent = Replace(HtmlContent,"{$CopyFrom}",CopyFrom)
	HtmlContent = Replace(HtmlContent,"{$About_Up}",About_Up)
	HtmlContent = Replace(HtmlContent,"{$About_Down}",About_Down)
	HtmlContent = Replace(HtmlContent,"{$ChannelID}",ChannelID)
	HtmlContent = Replace(HtmlContent,"{$ChannelTit}",ChannelTit)
	HtmlContent = Replace(HtmlContent,"{$ChannelDir}",ChannelDir)
	HtmlContent = Replace(HtmlContent,"{$ChannelName}",ChannelName)
	HtmlContent = Replace(HtmlContent,"{$ChannelUnit}",ChannelUnit)
	if not IsNul(SEOTitle) then
		HtmlContent = Replace(HtmlContent,"{$SEOTitle}",SEOTitle)
	else
		HtmlContent = Replace(HtmlContent,"{$SEOTitle}","")
	end if
	if not IsNul(SEOKeyWord) then
		HtmlContent = Replace(HtmlContent,"{$SEOKeyWord}",SEOKeyWord)
	else
		HtmlContent = Replace(HtmlContent,"{$SEOKeyWord}","")
	end if
	if not IsNul(SEODescript) then
		HtmlContent = Replace(HtmlContent,"{$SEODescript}",SEODescript)
	else
		HtmlContent = Replace(HtmlContent,"{$SEODescript}","")
	end if
	HtmlContent = ReplaceHtml(HtmlContent)
	HtmlContent = Html.ReadClass(HtmlContent)
	HtmlContent = Html.ReadClassName(HtmlContent)
	HtmlContent = Html.ReadChannelList(HtmlContent)
	HtmlContent = Html.ReadChannelPic(HtmlContent)
	HtmlContent = Html.ReadChannelFlash(HtmlContent)
	HtmlContent = Html.ReadChannelFlashqq(HtmlContent)
	HtmlContent = ReHtml(HtmlContent)
	If IsHtml=True Then
		ShowChannelView = HtmlContent
	Else
		Response.Write HtmlContent
	End If
	WriteTOFile ViewPath,HtmlContent
	Pic = ""
	HtmlContent = ""
	HtmlContent = ""
End Function

'****************************************************************
'函 数 名：GetSpecialPosition(ByVal strContent,ByVal BeginPoint,ByVal MaxCharperPage)
'作    用：解决把分页点放到了<img ,<p , <li等之间
'参    数：strContent 文章内容 BeginPoint 分页开始点 MaxCharperPage 每页字数
'****************************************************************
Private Function GetSpecialPosition(ByVal strContent, ByVal BeginPoint, ByVal MaxCharPerPage)
	Dim strTemp
	regEx.Pattern = "^(([^<]*>)[^<]{0,100})(?:<p|<img|<br|<li)*"
	strTemp = Right(strContent, Len(strContent) - BeginPoint)
	Set Matches = regEx.Execute(strTemp)
	If Matches.Count > 0 Then
		GetSpecialPosition = BeginPoint + Len(Matches(0).SubMatches(1)) + 1
	Else
		GetSpecialPosition = BeginPoint
	End If
End Function

'**************************************************
'函数名：GetContentPages
'作  用：显示"上一页 下一页"等信息
'参  数：totalPage ----总数量
'        CurrentPage ----当前页
'        HtmlFileUrl  ----链接地址
'返回值："上一页 下一页"等信息的HTML代码
'**************************************************
Private Function GetContentPages(totalPage, CurrentPage, HtmlFileUrl)
	Dim strPages
	Dim tmpArticleUrl
	Dim i
	Dim ShowPageNum '每页显示的页数
	Dim startFlag, endFlag '分页的开始结束标记
	ShowPageNum = 10
	If totalPage > ShowPageNum Then
		If (CurrentPage Mod ShowPageNum) <> 0 Then
			startFlag = (CurrentPage \ ShowPageNum) * ShowPageNum + 1
			endFlag = startFlag + ShowPageNum - 1
		Else
			startFlag = CurrentPage - ShowPageNum + 1
			endFlag = CurrentPage
		End If
	Else
		startFlag = 1
		endFlag = totalPage
	End If
	If endFlag > totalPage Then
		endFlag = totalPage
	End If
	
	tmpArticleUrl = Left(HtmlFileUrl, InStrRev(HtmlFileUrl, ".", -1, vbBinaryCompare) - 1)
	strPages = strPages & "<p align='center'><b>"
	If CurrentPage > 1 Then
		If ChannelIsCreateHtml = True Then
			If CurrentPage > 2 Then
				If CurrentPage > ShowPageNum And CurrentPage <= totalPage And startFlag > 1 Then
					strPages = strPages & "<a href='" & tmpArticleUrl & "_" & startFlag - 1 & ChannelHtmlExtName & "'>&nbsp;&lt;&lt;&nbsp;</a>"
				End If
				strPages = strPages & "<a href='" & tmpArticleUrl & "_" & CurrentPage - 1 & ChannelHtmlExtName & "'>上一页</a>&nbsp;&nbsp;"
			Else
				strPages = strPages & "<a href='" & tmpArticleUrl & ChannelHtmlExtName & "'>上一页</a>&nbsp;&nbsp;"
			End If
		Else
			If CurrentPage > ShowPageNum And CurrentPage <= totalPage Then
				strPages = strPages & "<a href='" & strFileName & "?id=" & Vid & "&Page=" & startFlag - 1 & "' >&nbsp;&lt;&lt;&nbsp;</a>"
			End If
			strPages = strPages & "<a href='" & strFileName & "?id=" & Vid & "&Page=" & CurrentPage - 1 & "'>上一页</a>&nbsp;&nbsp;"
		End If
	End If

	For i = startFlag To endFlag
		If i = CurrentPage Then
			strPages = strPages & "<font color='red'>[" & CStr(i) & "]</font>&nbsp;"
		Else
			If ChannelIsCreateHtml = True Then
				If i > 1 Then
					strPages = strPages & "<a href='" & tmpArticleUrl & "_" & i & ChannelHtmlExtName & "'>[" & i & "]</a>&nbsp;"
				Else
					strPages = strPages & "<a href='" & tmpArticleUrl & ChannelHtmlExtName & "'>[" & i & "]</a>&nbsp;"
				End If
			Else
				strPages = strPages & "<a href='" & strFileName & "?id=" & Vid & "&Page=" & i & "'>[" & i & "]</a>&nbsp;"
			End If
		End If
	Next
	If endFlag < totalPage Then
		strPages = strPages & " ... "
	End If
	If CurrentPage < totalPage Then
		If ChannelIsCreateHtml = True Then
			strPages = strPages & "<a href='" & tmpArticleUrl & "_" & CurrentPage + 1 & ChannelHtmlExtName & "'>下一页</a> "
			If totalPage > ShowPageNum And endFlag < totalPage Then
				strPages = strPages & "<a href='" & tmpArticleUrl & "_" & endFlag + 1 & ChannelHtmlExtName & "'>&nbsp;&gt;&gt;&nbsp;</a>"
			End If
		Else
			strPages = strPages & "&nbsp;<a href='" & strFileName & "?id=" & Vid & "&Page=" & CurrentPage + 1 & "'>下一页</a>"
			If totalPage > endFlag Then
				strPages = strPages & "<a href='" & strFileName & "?id=" & Vid & "&Page=" & endFlag + 1 & "'>&nbsp;&gt;&gt;&nbsp;</a>"
			End If
		End If
	End If
	strPages = strPages & "</b></p>"
	GetContentPages = strPages
End Function
%>